from funboost import boost, BrokerEnum, BoosterParams, AsyncResult
from funboost import (
    boost,
    BrokerEnum,
    BoosterParams,
    FunctionResultStatusPersistanceConfig
)


@boost(BoosterParams(queue_name="test_queue", broker_kind=BrokerEnum.RABBITMQ_AMQPSTORM, concurrent_num=1,
                     is_send_consumer_hearbeat_to_redis=True, max_retry_times=3, function_result_status_persistance_conf=FunctionResultStatusPersistanceConfig(
                         is_save_result=True,
                         is_save_status=True,
                         expire_seconds=2 * 365 * 7 * 24 * 3600,
                         is_use_bulk_insert=True,
                     ),
                     ))
def test(prompt):
    print(prompt)
    return prompt


if __name__ == "__main__":
    prompt = """请介绍一下什么是机器学习"""
    for i in range(1):
        async_result = test.push(prompt)

    test.consume()
